package com.chinasoft.controller;

import com.chinasoft.bean.Student;
import com.chinasoft.service.StudentService;
import com.chinasoft.service.impl.StudentServiceImpl;
import org.junit.Test;

import java.util.List;

public class StudentController {
    private StudentService service = new StudentServiceImpl();


//
//    @Test
//    public void delete(){
//
//        service.delete("StudentMapper.delete",6);
//        //sqlSession.commit();
//
//    }
//    @Test
//    public void update(){
//        Student student = new Student(5,"李蕾",23);
//        service.update("StudentMapper.update",student);
//
//
//    }
//
//    @Test
//    public void insert() {
//        Student student = new Student(5, "李蕾", 20);
//        service.insert("StudentMapper.insert", student);
//        //sqlSession.commit();
//    }

    @Test
    public  void delete(){
        service.delete(6);
    }
    @Test
    public  void update(){
        service.update(new Student(6,"liugang",38));
    }
    @Test
    public void insert (){
        service.insert(new Student(6,"刘刚",30));
    }

    @Test
    public void selectById(){
        System.out.println(service.selectById(3));
    }

    @Test
    public void selectAll(){
        List<Student> studentList = service.selectAll();
        studentList.forEach(System.out::println);
    }


}